import Express from 'express';
import React from 'react';
/**
 * renderToString 把jsx转字符串
 * renderToString(<Main />)
 */
import {renderToString, renderToStaticMarkup} from 'react-dom/server';

const app = Express();

class Main extends React.Component{
    render(){
        return <div>hi</div>
    }
}

app.get('/', (req, res) => {
    res.send(renderToString(<Main />));
});
 
app.listen(9093, () => {
    console.log('listened');
});